﻿<%@ include file="/WEB-INF/jsp/include.jsp" %>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F8F9FA;
}
-->
</style>

<link href="<%=request.getContextPath()%>/images/skin.css" rel="stylesheet" type="text/css" />
<script src="<%=request.getContextPath()%>/js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=syscontextPath %>/js/My97DatePicker/WdatePicker.js" ></script>
<style type="text/css">
<!--
.STYLE2 {font-size: 12px}
.STYLE3 {
	font-size: 16px;
	font-weight: bold;
}
-->
</style>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="<%=request.getContextPath()%>/images/mail_leftbg.gif"><img src="<%=request.getContextPath()%>/images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="<%=request.getContextPath()%>/images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">新增订单</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="<%=request.getContextPath()%>/images/mail_rightbg.gif"><img src="<%=request.getContextPath()%>/images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="<%=request.getContextPath()%>/images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td height="20"><table width="100%" height="1" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
              <tr>
                <td></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td><table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
              <tr>
                <td width="10%" height="55" valign="middle"><img src="<%=request.getContextPath()%>/images/title.gif" width="54" height="55"></td>
                <td width="90%" valign="top"><p class="left_txt2 STYLE2">在这里，你可以新增订单，订单编号自动生成</p>
                  <p class="left_txt2 STYLE2">&nbsp;</p></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
              <tr>
                <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;新增订单信息</td>  <a href="<%=request.getContextPath()%>/orders/findOrderById/5">订单</a>
              </tr>
            </table></td>
          </tr>
          <form name="addorders" id="addorders" action="<%=request.getContextPath()%>/orders/addorders" method="post">
          <input type="hidden" name="orderno" value="${orderno}"/>
          <tr>
            <td>
                <table width="100%" height="90" border="0" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="19%" align="center" bgcolor="#f2f2f2" class="left_txt"><div align="right">订单编号：</div></td>
                    <td width="23%" bgcolor="#f2f2f2" class="left_txt"><div align="left" class="STYLE3">${orderno}</div></td>
                    <td width="11%" bgcolor="#f2f2f2" class="left_txt">&nbsp;</td>
                    <td width="47%" bgcolor="#f2f2f2" class="left_txt">&nbsp;</td>
                  </tr>
                  <tr>
                    <td align="center" class="left_txt"><div align="right">经销商：</div></td>
                    <td class="left_txt">
                        <div align="left">
                          <select name="source" id="source">
                          		<option value="-1">请选择</option>
                                   <c:forEach items="${dealer_list}" var="dealer" >
                                 <option value="${dealer.id}">${dealer.name}</option>
                                 </c:forEach>
                           </select>
                         </div></td>
                    <td class="left_txt"><div align="right">订金：</div></td>
                    <td class="left_txt"><input type="disposit" id="disposit"  style="color=red" name="dxb2" value="${order.disposit}" size="30" class="button01" />元</td>
                  </tr>
                  <tr>
                    <td align="center" bgcolor="#f2f2f2" class="left_txt"><div align="right">客户名称：</div></td>
                    <td colspan="3" bgcolor="#f2f2f2" class="left_txt"><div align="left">
                      <input type="text" style="color=red" name="customer" id="customer"   value="${order.customer}" size="30" class="button01" />
                    </div></td>
                    </tr>
                  <tr>
                    <td align="center" class="left_txt"><div align="right">客户地址：</div></td>
                    <td colspan="3" class="left_txt">
                        <div align="left">
                          <input type="text" style="color=red" name="address" id="address" value="${order.address}" size="60" class="button01" />                    
                        </div></td>
                    </tr>
                   <tr>
                    <td width="19%" align="center" bgcolor="#f2f2f2" class="left_txt"><div align="right">用户手机：</div></td>
                    <td width="23%" bgcolor="#f2f2f2" class="left_txt"><div align="left">
                      <input type="text" style="color=red"  size="30" name="mobile" id="mobile" value="${order.mobile}"  class="button01" />
                    </div></td>
                    <td width="11%" bgcolor="#f2f2f2" class="left_txt"><div align="right">用户电话：</div></td>
                    <td width="47%" bgcolor="#f2f2f2" class="left_txt">
                    <input type="text" style="color=red"  name="telephone" id="telephone" value="${order.telephone}" size="30" class="button01" /></td>
                  </tr>
                  <tr>
                    <td align="center" class="left_txt"><div align="right">下单时间：</div></td>
                    <td class="left_txt"><div align="left">
                      <input type="text" style="color=red" name="startdate" id="startdate"   value="${order.startdate}" size="30" onClick="WdatePicker()" />
                    </div></td>
                    <td class="left_txt"><div align="right">预计交货时间：</div></td>
                    <td class="left_txt"><input type="text" style="color=red" name="enddate" id="enddate" value="${order.enddate}" size="30"  onClick="WdatePicker()"/></td>
                  </tr>
                   <tr>
                    <td width="19%" align="center" bgcolor="#f2f2f2" class="left_txt"><div align="right">送货方式：</div></td>
                    <td width="23%" bgcolor="#f2f2f2" class="left_txt"><div align="left">
                      <select name="transporttye" id="transporttye" onChange="transport_onchange()">
                       <option value="-1" selected="true">请选择</option>
                        <option value="0">发物流</option>
                        <option value="1">送货上门</option>
                        <option value="2">自提</option>
                      </select>
                    </div></td>
                    <span style="display:none;" id="transport_wuliu">
                    <td width="11%" bgcolor="#f2f2f2" class="left_txt"><div align="right">物流公司：</div></td>
                    <td width="47%" bgcolor="#f2f2f2" class="left_txt"><input type="text" style="color=red" name="transport" id="transport" value="${order.transport}" size="30" class="button01" /></td>
                    </span>
                  </tr>
                  <tr>
                    <td colspan="4" align="center" class="left_txt"><form name="form1" method="post" action="">
                      <input type="button" name="button" id="button" onClick="check_addorder()" value="确定并下单">
                    </form></td>
                    </tr>
                  <tr>
                    <td>&nbsp;&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                  </tr>
                </table>

             </td>
          </tr>
          </form>
          
        </table>
          </td>
      </tr>
    </table></td>
    <td background="<%=request.getContextPath()%>/images/mail_rightbg.gif">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="<%=request.getContextPath()%>/images/mail_leftbg.gif"><img src="<%=request.getContextPath()%>/images/buttom_left2.gif" width="17" height="17" /></td>
      <td height="17" valign="top" background="<%=request.getContextPath()%>/images/buttom_bgs.gif"><img src="<%=request.getContextPath()%>/images/buttom_bgs.gif" width="17" height="17" /></td>
    <td background="<%=request.getContextPath()%>/images/mail_rightbg.gif"><img src="<%=request.getContextPath()%>/images/buttom_right2.gif" width="16" height="17" /></td>
  </tr>
</table>

</body>
<script type="text/javascript">
	jQuery(function($) {
		transport_onchange();
		
	});
function transport_onchange(){
	var transporttye=$('#transporttye').val();
	if(transporttye==0){
	   $('#transport_wuliu').show();
	}else{
	 $('#transport_wuliu').hide();
	}
}


function check_addorder(){
		var orderno="${orderno}";
		var source=$('#source').val();
		var disposit=$('#disposit').val();
		var customer=$('#customer').val();
		var address=$('#address').val();
		var mobile=$('#mobile').val();
		var telephone=$('#telephone').val();
		var createdate=$('#startdate').val();
		var enddate=$('#enddate').val();
		var transporttye=$('#transporttye').val();
		
	    if(source==-1){
			alert("请选择经销商");
			return false;
		}
		
		if(createdate==''){
			alert("请输入下单时间");
			$('#startdate').focus();
			return false;
		}
		if(transporttye==-1){
			alert("请选择送货方式");
			return false;
		
		}
		
	    $('#addorders').submit();
	
}
</script>
